package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.*;
import cn.gson.crm.model.service.DeliverRecordService;
import cn.gson.crm.model.service.DeliveryPlanService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/DeliverRecordController")
public class DeliverRecordController {
    @Autowired
    DeliverRecordService deliverRecordService;
    @RequestMapping("/ContractMethod")
    @ResponseBody
    //查询当前登录人所有交付记录
    public Map<String,Object> selectrec(HttpSession session, Integer pid, Integer page, Integer size){
        return deliverRecordService.selectrec(session,pid,page,size);
    };
    @RequestMapping("/ContractMethod1")
    @ResponseBody
    //客户
    public List<Customer> selectcustomer(Integer yg){
        return  deliverRecordService.selectcustomer(yg);
    };
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //通过客户id查询交付计划
    public List<DeliveryPlan> selectdel(Integer cid){
       return  deliverRecordService.selectdel(cid);

    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //多条件查询
    public  Map<String,Object> selectwhere( HttpSession session,Integer pid, String where,Integer page, Integer size){
        return deliverRecordService.selectwhere(session,pid,where,page,size);
    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    //时间查询
    public Map<String,Object> selecttime( HttpSession session,Integer pid,String statr,String endtime,Integer page, Integer size){
        return deliverRecordService.selecttime(session,pid,statr,endtime,page,size);
    };
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    //查询订单
    public List<DeliveryPlan> selectorder(Integer pid){
        return deliverRecordService.selectorder(pid);
    };
    @RequestMapping("/ContractMethod6")
    @ResponseBody
    //新增
    public void savedelive(@RequestBody  DeliveryRecord deliveryRecord){
        deliverRecordService.savedelive(deliveryRecord);
    }
    @RequestMapping("/ContractMethod7")
    @ResponseBody
    //查询详单
    public List<OrderDetails> selectoid(Integer oid){
        return deliverRecordService.selectoid(oid);
    }
    @RequestMapping("/ContractMethod8")
    @ResponseBody
    public List<DeliveryScheduleDetails> selectDe(Integer did){
        return deliverRecordService.selectDe(did);
    };
}
